<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
  <div id="container">
    <h1 aria-hidden="true">h1 <b>test</b></h1>
    <h2 aria-hidden="false">h2</h2>
  </div>

<script>
test((t) => {
    var container = accessibilityController.accessibleElementById("container");
    var h1 = container.childAtIndex(0);
    assert_equals(h1.name, "h1 test");
    assert_true(h1.isIgnored);
    var h2 = container.childAtIndex(1);
    assert_equals(h2.name, "h2");
    assert_false(h2.isIgnored);
}, "This tests that the aria-hidden attribute works correctly with accessibility. The H1 element should be ignored and the H2 element should not be ignored, but they should both appear in the accessibility tree.");


</script>

<div id="hidden-container" style="display: none">
  <h2 aria-hidden="false">h2</h2>
</div>

<script>
test((t) => {
    var hiddenContainer = accessibilityController.accessibleElementById("hidden-container");
    assert_true(hiddenContainer.isIgnored);
    assert_equals(hiddenContainer.childrenCount, 1);
    var ariaVisibleH2 = hiddenContainer.childAtIndex(0);
    assert_false(ariaVisibleH2.isIgnored);
}, "Elements with aria-hidden=false inside a non-rendered element should be exposed in the accessibility tree, and not ignored");
  </script>
</body>
</html>
